"use strict";

const { rspack } = require("@rspack/core");

const { RspackDevServer } = require("@rspack/dev-server");
const h3 = require("h3");
const DevServer = require("webpack-dev-server");
const config = require("./rspack.config.cjs");

const compiler = rspack(config);

const middleware = rspack.experiments.lazyCompilationMiddleware(compiler);
const server = new RspackDevServer(
  {
    setupMiddlewares(other) {
      return [middleware, ...other];
    },
  },
  compiler,
);

const h3App = h3
  .createApp({
    debug: true,
  })
  .use((handler) => server);
